function mySqrt(x: number): number {
    let num: any = 0;
    while(num*num <= x ){
        num++;
    }
    num-=1;
    return parseInt(num);
};

// let x = 4;
let x = 999;
console.log(mySqrt(x));